/*
 * @Author: Lin Hongwei
 * @Date: 2022-10-09 23:22:23
 * @LastEditTime: 2022-10-09 23:35:38
 * @LastEditors: Lin Hongwei
 * @email: 1365755396@qq.com
 * @CSDN: https://blog.csdn.net/weixin_45429409
 * @Description: 字符串指定字段高亮
 */
export const MarkText = ({
  name,
  keyword,
}: {
  name: string;
  keyword: string;
}) => {
  if (!keyword) return <p>{name}</p>;
  const arr = name.split(keyword);
  const str = arr.join(`<span style="color:red;">${keyword}</span>`);
  return <p dangerouslySetInnerHTML={{ __html: str }}></p>;
};
